/*
 *   ControlUI.h
 *
 *	 Copyright(c) 2012 by Joe Kilner
 *   This file is part of Panoptik.
 *
 *   Panoptik is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   Panoptik is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU Lesser General Public License for more details.
 *
 *   You should have received a copy of the GNU Lesser General Public License
 *   along with Panoptik.  If not, see <http://www.gnu.org/licenses/>.
 */
 
// -*- C++ -*- generated by wxGlade 0.6.3 on Tue Jan 17 14:53:59 2012

#include <wx/wx.h>
#include <wx/image.h>
#include <zmq.hpp>

#ifndef CONTROLUI_H
#define CONTROLUI_H

// begin wxGlade: ::dependencies
// end wxGlade

// begin wxGlade: ::extracode

// end wxGlade

class Panoptik;
class ControlThread;

class ControlUI: public wxFrame {
public:
    // begin wxGlade: ControlUI::ids
    enum {
        menu_quit = wxID_HIGHEST + 1001,
        action_save_all = wxID_HIGHEST + 1003,
        action_save_all_browse = wxID_HIGHEST + 1005,
        action_save = wxID_HIGHEST + 1007,
        action_save_browse = wxID_HIGHEST + 1009,
        action_master = wxID_HIGHEST + 1011,
        action_slave = wxID_HIGHEST + 1013,
        action_load_calibration = wxID_HIGHEST + 1015,
        action_load_calibration_browse = wxID_HIGHEST + 1017,
        action_name_combo_1 = wxID_HIGHEST + 1019,
        action_checkbox_1 = wxID_HIGHEST + 1021,
        action_name_combo_2 = wxID_HIGHEST + 1023,
        action_checkbox_2 = wxID_HIGHEST + 1025,
        action_name_combo_3 = wxID_HIGHEST + 1027,
        action_checkbox_3 = wxID_HIGHEST + 1029,
        action_name_combo_4 = wxID_HIGHEST + 1031,
        action_checkbox_4 = wxID_HIGHEST + 1033
    };
    // end wxGlade

    enum NetState{
    	master,
    	slave,
    	solo
    };

    ControlUI(wxWindow* parent, int id, const wxString& title, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE);
    virtual ~ControlUI();

    void setApp(Panoptik *pApp);

private:
    // begin wxGlade: ControlUI::methods
    void set_properties();
    void do_layout();
    // end wxGlade

    NetState _netState;
    zmq::socket_t *_pSocket;

protected:
    // begin wxGlade: ControlUI::attributes
    wxMenuBar* control_menubar;
    wxButton* save_all_action;
    wxTextCtrl* save_all_path;
    wxButton* save_all_browser;
    wxButton* save_action;
    wxTextCtrl* save_path;
    wxButton* save_browser;
    wxButton* master_action;
    wxTextCtrl* master_port;
    wxButton* slave_action;
    wxTextCtrl* slave_port;
    wxTextCtrl* slave_ip;
    wxButton* load_calibration_action;
    wxTextCtrl* load_calibration_path;
    wxButton* load_calibration_browser;
    wxStaticText* device_label_1;
    wxComboBox* name_combo_1;
    wxCheckBox* checkbox_1;
    wxStaticText* device_label_2;
    wxComboBox* name_combo_2;
    wxCheckBox* checkbox_2;
    wxStaticText* device_label_3;
    wxComboBox* name_combo_3;
    wxCheckBox* checkbox_3;
    wxStaticText* device_label_4;
    wxComboBox* name_combo_4;
    wxCheckBox* checkbox_4;
    wxPanel* panel_1;
    // end wxGlade

    Panoptik *_pApp;

    void threadRunSlave();
    void threadSaveMaster();
    void threadSaveAllMaster();
    int getMinID();

    friend class ControlThread;
    ControlThread *_pThread;

    DECLARE_EVENT_TABLE();

public:
    virtual void onQuitApp(wxCommandEvent &event); // wxGlade: <event_handler>
    virtual void onSaveAll(wxCommandEvent &event); // wxGlade: <event_handler>
    virtual void onSaveAllBrowse(wxCommandEvent &event); // wxGlade: <event_handler>
    virtual void onSave(wxCommandEvent &event); // wxGlade: <event_handler>
    virtual void onSaveBrowse(wxCommandEvent &event); // wxGlade: <event_handler>
    virtual void onRunMaster(wxCommandEvent &event); // wxGlade: <event_handler>
    virtual void onRunSlave(wxCommandEvent &event); // wxGlade: <event_handler>
    virtual void onLoadCalibration(wxCommandEvent &event); // wxGlade: <event_handler>
    virtual void onLoadCalibrationBrowse(wxCommandEvent &event); // wxGlade: <event_handler>
    virtual void onDevice1NameChange(wxCommandEvent &event); // wxGlade: <event_handler>
    virtual void onDevice1Enable(wxCommandEvent &event); // wxGlade: <event_handler>
    virtual void onDevice2NameChange(wxCommandEvent &event); // wxGlade: <event_handler>
    virtual void onDevice2Enable(wxCommandEvent &event); // wxGlade: <event_handler>
    virtual void onDevice3NameChange(wxCommandEvent &event); // wxGlade: <event_handler>
    virtual void onDevice3Enable(wxCommandEvent &event); // wxGlade: <event_handler>
    virtual void onDevice4NameChange(wxCommandEvent &event); // wxGlade: <event_handler>
    virtual void onDevice4Enable(wxCommandEvent &event); // wxGlade: <event_handler>
}; // wxGlade: end class


#endif // CONTROLUI_H
